﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Web.Configuration;
using Business;

namespace HotelBrisayArena
{
    public partial class AgregarImagen : System.Web.UI.Page
    {
        ImagenBusiness imgBusiness = new ImagenBusiness(WebConfigurationManager.ConnectionStrings["ApplicationServices"].ToString());
       
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Button1_Click(object sender, EventArgs e)
        {

            if (FileUpload1.HasFile)
            {
                using (BinaryReader reader = new BinaryReader(FileUpload1.PostedFile.InputStream))
                {

                    byte[] image = reader.ReadBytes(FileUpload1.PostedFile.ContentLength);
                    //Carga Cualquier imagen pero hay que relacionarlas en la base de datos...
                    imgBusiness.GuardarImagen(image);
                    

                }
            }
        }
    }
}